package com.ruowei.modules.foodOrder.repository;

import com.ruowei.common.repository.BaseRepository;
import com.ruowei.modules.foodOrder.domain.Couriers;
import com.ruowei.modules.foodOrder.domain.QCouriers;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * Spring Data  repository for the Couriers entity.
 */
@SuppressWarnings("unused")
@Repository
public interface CouriersRepository extends BaseRepository<Long, Couriers, QCouriers> {

    Boolean existsByPhone(String phone);

    Boolean existsByPhoneAndIdNot(String phone, Long id);

    Optional<Couriers> findFirstByCourierCode(String courierCode);

    Optional<Couriers> findOneByCourierCode(String courierCode);

    Optional<Couriers> findOneByCourierCodeAndAvailableStatus(String courierCode, Boolean availableStatus);

    Boolean existsByCourierCodeAndAvailableStatusAndOnLineStatus(String courierCode, Boolean availableStatus, Boolean onLineStatus);
}
